package travelDream.converter;

import javax.ejb.EJB;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

import travelDream.bean.GestoreProdottoBase;
import travelDream.dto.VoloDTO;

public class TrasportoConverter implements Converter {

	@EJB
	GestoreProdottoBase gest;
	
	
	@Override
	public Object getAsObject(FacesContext context, UIComponent component, String value) {
		return (VoloDTO)gest.findVoloById(Integer.parseInt(value));
	}

	@Override
	public String getAsString(FacesContext context, UIComponent component, Object value) {
		return String.valueOf(((VoloDTO) value).getId());
	}

}
